package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                    import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.SmsAreaNumberConfigMapper;
import com.ruoyi.bizsys.domain.SmsAreaNumberConfig;
import com.ruoyi.bizsys.service.ISmsAreaNumberConfigService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 短信路由配置Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class SmsAreaNumberConfigServiceImpl extends ServiceImpl<SmsAreaNumberConfigMapper,SmsAreaNumberConfig> implements ISmsAreaNumberConfigService {

    /**
     * 查询短信路由配置
     *
     * @param id 短信路由配置ID
     * @return 短信路由配置
     */
    @Override
    public SmsAreaNumberConfig selectSmsAreaNumberConfigById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询短信路由配置列表
     *
     * @param smsAreaNumberConfig 短信路由配置
     * @return 短信路由配置
     */
    @Override
    public List<SmsAreaNumberConfig> selectSmsAreaNumberConfigList(SmsAreaNumberConfig smsAreaNumberConfig) {
        return this.list(new QueryWrapper<>(smsAreaNumberConfig).last("order by id desc"));
    }

    /**
     * 新增短信路由配置
     *
     * @param smsAreaNumberConfig 短信路由配置
     * @return 结果
     */
            @Override
    public int insertSmsAreaNumberConfig(SmsAreaNumberConfig smsAreaNumberConfig) {
                                                                                                                                                                                                    smsAreaNumberConfig.setCreateTime(DateUtils.getNowDate());
                                                                    return baseMapper.insert(smsAreaNumberConfig);
    }

    /**
     * 修改短信路由配置
     *
     * @param smsAreaNumberConfig 短信路由配置
     * @return 结果
     */
            @Override
    public int updateSmsAreaNumberConfig(SmsAreaNumberConfig smsAreaNumberConfig) {
                                                                                                                                                                                                                                            smsAreaNumberConfig.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(smsAreaNumberConfig);
    }

    /**
     * 批量删除短信路由配置
     *
     * @param ids 需要删除的短信路由配置ID
     * @return 结果
     */
            @Override
    public int deleteSmsAreaNumberConfigByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除短信路由配置信息
     *
     * @param id 短信路由配置ID
     * @return 结果
     */
    @Override
    public int deleteSmsAreaNumberConfigById(Long id) {
        return baseMapper.deleteById(id);
    }

    @Override
    public List<SmsAreaNumberConfig> selectSmsAreaNumberConfig() {
        return baseMapper.selectSmsAreaNumberConfig();
    }

}
